package com.pty.demo.creational.factory.common;

/**
 * @author pengty
 * @date 2020/3/11
 */
public class CookingFactory {

    public static Cooking getCooking(String code) {
        if ("fish".equals(code)) {
            return new FishCooking();
        }
        if ("tomato".equals(code)) {
            return new TomatoCooking();
        }
        if ("meat".equals(code)) {
            return new MeatCooking();
        }
        throw new IllegalArgumentException("unexpect parameter code");
    }
}
